//
//  SEGTarget_NewVersion.m
//  SEGUhomeStandard
//
//  Created by 刘山 on 2018/3/20.
//  Copyright © 2018年 刘山. All rights reserved.
//

#import "SEGTarget_NewVersion.h"
#import "SEGNewVersionViewController.h"
#import "SEGNewVersionManager.h"

@implementation SEGTarget_NewVersion
/**
 * 初始化新特性界面
 * @author Sam
 * @param params  跳转参数
 */
-(UIViewController*)segAction_initNewVersionViewController:(NSDictionary*)params{
    SEGNewVersionViewController *VC = [[SEGNewVersionViewController alloc]init];
    return VC;
}

/**
 * 跳转到新特性界面
 * @author Sam
 */
-(void)segAction_pushToNewVersionViewController:(NSDictionary*)params{
    UIViewController *VC = [[SEGNewVersionViewController alloc]init];
    
    UIViewController *newVC = [[SEGUhomeMediator sharedInstance] seg_initNavigationController:@{@"vc":VC}];
    
    [UIApplication sharedApplication].delegate.window.rootViewController = newVC;
    [UIView transitionWithView:[UIApplication sharedApplication].delegate.window duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
        [UIApplication sharedApplication].delegate.window.rootViewController = newVC;
    } completion:nil];

}

/**
 * 检测新版本
 * @author Sam
 */
-(void)segAction_checkVersion:(NSDictionary*)params{
    [SEGNewVersionManager segCheckVersion];
}

/**
 * 获取升级版本号信息
 * @author Sam
 */
-(NSString*)segAction_getVersion:(NSDictionary*)params{
    return [SEGNewVersionManager segGetVersione];
}

/**
 * 保存升级版本号信息
 * @author Sam
 */
-(void)segAction_saveVersion:(NSDictionary*)params{
    [SEGNewVersionManager segSaveVersion];
}

/**
 * 检查是否有新的版本
 * @author Sam
 */
-(NSString*)segAction_compareVersion:(NSDictionary*)params{
    return [SEGNewVersionManager segCompareVersion];
}

/**
 * 检查是否有新的版本并且进行跳转
 * @author Sam
 */
-(void)segAction_compareVersionAndPush:(NSDictionary*)params{
    [SEGNewVersionManager segCompareVersionAndPush];
}
@end
